#pragma once
#include <string>
#include "mesh.h"
// 弹簧法实现动网格
class springSmooth
{
private:
    mesh grid;

    double _k_frac;
    double _mag;
    double _t;
    double _dt;
    unsigned int _nt;
    bool _enableTimeStep;
    const int max_run_count = 10000;
    std::vector<std::vector<double>> d_previous;
    std::vector<std::vector<double>> d_current;
    double _residual_max;
    double residual;
public:
    void run();
    void generateMesh();
    void saveMesh();
    void getTopology();
    void outNewMesh(const double & current_t);
    // 构造函数
    springSmooth();
    springSmooth(const bool & enableTimeStep, const double & residual_rel, const int & nt, const double & k_frac = 0.5, const double & mag = 1.0, const double & t = 1.0);

    ~springSmooth();
};